<template>
  <button @click="showComponent = MyLeft">MyLeft</button>
  <button @click="showComponent = Myright">MyRight</button>
  <div>
    <KeepAlive exclude="MyLeft">
      <component :is="showComponent"></component>
    </KeepAlive>
  </div>
</template>

<script setup>
import { shallowRef } from "vue";
import MyLeft from "./MyLeft.vue";
import Myright from "./Myright.vue";

const showComponent = shallowRef(MyLeft);
</script>

<style lang="scss" scoped></style>
